﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GanagroLiteBO;

namespace GanagroLite
{
    public partial class FormSeleccionFechas : Form
    {
        private EnumReportes _RepNumber;
        public DateTime FechaSeleccionada { get; set; }

        public FormSeleccionFechas(EnumReportes RepNumber)
        {
            InitializeComponent();
            _RepNumber = RepNumber;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            FechaSeleccionada  = DateTime.Parse(this.listBox1.SelectedValue.ToString());
            this.Hide();
        }


        private void Form1_Load(object sender, EventArgs e)
        {
            this.bindingSourceFecha.DataSource = PresenterBO.GetFechas(_RepNumber);
            this.listBox1.DisplayMember = "Fecha";
            this.listBox1.ValueMember = "Fecha";
            this.listBox1.SelectedIndex = 0;

        }

        private void listBox1_DoubleClick(object sender, EventArgs e)
        {
            FechaSeleccionada = DateTime.Parse(this.listBox1.SelectedValue.ToString());
            this.Hide();
            //          this.Close();
        }

        private void FormSeleccionFechas_FormClosing(object sender, FormClosingEventArgs e)
        {
            e.Cancel = true;
            this.Hide();
        }
    }
}
